import Vue from 'vue'
import VueRouter from 'vue-router'

//解决面包屑导航刷新当前页面错误
const originalReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location) {
  return originalReplace.call(this, location).catch(err => err);
}
Vue.use(VueRouter)
import Layout from '../layout'
const routes = [{
    path: '/',
    component: Layout,
    redirect: "/index",
    children: [{
      path: 'index',
      meta: {
        title: "首页",
        affix: true
      },
      name: 'index',
      component: (resolve) => require(['../views/index'], resolve)
    }]
  },
  {
    path: '/setone',
    name: 'setone',
    component: Layout,
    children: [{
      path: 'index',
      meta: {
        title: "设置1",

      },
      component: (resolve) => require(['../views/setone'], resolve)
    }]
  },
  {
    path: '/settwo',
    name: 'settwo',
    component: Layout,
    children: [{
      path: 'index',
      meta: {
        title: "设置2",

      },
      component: (resolve) => require(['../views/settwo'], resolve)
    }]
  },
  {
    path: '/setthree',
    name: 'setthree',
    component: Layout,
    children: [{
      path: 'index',
      meta: {
        title: "设置3",

      },
      component: (resolve) => require(['../views/setthree'], resolve)
    }]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: '/develop_setter/',
  routes
})

export default router
